GraphicsDetect = {

  checkCanvas : function() {
    return Modernizr.canvas;
  },

  checkSVG : function() {
    return Modernizr.svg;
  },

  checkCSS3D : function() {
    return Modernizr.csstransforms3d;
  },

  checkWebGL : function(opt_extensions) {
    if (opt_extensions == null)
      opt_extensions = [];
    var ok = {
      supported : false,
      supportedExtensions : [],
      missingExtensions : opt_extensions
    };
    var c = document.createElement('canvas');
    var ctx = null;
    try { ctx = c.getContext('webgl'); } catch(e) {}
    try { ctx = ctx ? ctx : c.getContext('experimental-webgl'); } catch(e) {}
    if (ctx == null) {
      return ok;
    }
    ok.supported = true;
    ok.webGL = true;
    ok.missingExtensions = [];
    try {
      ok.supportedExtensions = ctx.getSupportedExtensions();
    } catch(e) {}
    for (var i=0; i<opt_extensions.length; i++) {
      var extName = opt_extensions[i];
      if (extName == '')
        continue;
      var ext = null;
      try { ext = ctx.getExtension(extName); } catch(e) {}
      if (!ext) {
        ok.supported = false;
        ok.missingExtensions.push(extName);
      }
    }
    return ok;
  }

};
